package com.yueya.api.bed;


import com.jfinal.aop.Before;
import com.jfinal.aop.Duang;
import com.jfinal.kit.JsonKit;
import com.yueya.common.action.ApiController;
import com.yueya.common.action.ApiInterceptor;
import com.yueya.common.model.Resp;

import net.sf.json.JSONObject;
/**
 * 床位管理
 * @author 41654
 *
 */
@Before(ApiInterceptor.class)
public class IBedController  extends ApiController {
	
	
	/** 
	 * 获取楼栋
	 * @title 获取楼栋
	 * @param pgn|页码|int|不必填
     * @param pgs|返回数据|int|不必填
	 * @respBody {"msg":null,"code":"10000","data":{"totalRow":2,"pageNumber":1,"firstPage":true,"lastPage":true,"totalPage":1,"pageSize":10,"list":[]}}
	 */
	public void getPageHouse() {
		JSONObject jo = this.getJson();
		Resp resp = Duang.duang(IBedService.class).getPageHouse(jo);
		renderJson(JsonKit.toJson(resp));
	}


	/** 
	 * 获取楼层
	 * @title 获取楼层
	 * @param pgn|页码|int|不必填
     * @param pgs|返回数据|int|不必填
	 * @respBody {"msg":null,"code":"10000","data":{"totalRow":2,"pageNumber":1,"firstPage":true,"lastPage":true,"totalPage":1,"pageSize":10,"list":[]}}
	 */
	public void getPageFloor() {
		JSONObject jo = this.getJson();
		Resp resp = Duang.duang(IBedService.class).getPageFloor(jo);
		renderJson(JsonKit.toJson(resp));
	}

	/** 
	 * 获取房间
	 * @title 获取房间
	 * @param pgn|页码|int|不必填
     * @param pgs|返回数据|int|不必填
	 * @respBody {"msg":null,"code":"10000","data":{"totalRow":2,"pageNumber":1,"firstPage":true,"lastPage":true,"totalPage":1,"pageSize":10,"list":[]}}
	 */
	public void getPageRoom() {
		JSONObject jo = this.getJson();
		Resp resp = Duang.duang(IBedService.class).getPageRoom(jo);
		renderJson(JsonKit.toJson(resp));
	}

	/** 
	 * 获取床
	 * @title 获取床
	 * @param pgn|页码|int|不必填
     * @param pgs|返回数据|int|不必填
	 * @respBody {"msg":null,"code":"10000","data":{"totalRow":2,"pageNumber":1,"firstPage":true,"lastPage":true,"totalPage":1,"pageSize":10,"list":[]}}
	 */
	public void getPageBed() {
		JSONObject jo = this.getJson();
		Resp resp = Duang.duang(IBedService.class).getPageBed(jo);
		renderJson(JsonKit.toJson(resp));
	}

	// 添加床
	public void saveBed() {
		JSONObject jo = this.getJson();
		Resp resp = Duang.duang(IBedService.class).saveBed(jo);
		renderJson(JsonKit.toJson(resp));
	}
	

	// 添加房间
	public void saveRoom() {
		JSONObject jo = this.getJson();
		Resp resp = Duang.duang(IBedService.class).saveRoom(jo);
		renderJson(JsonKit.toJson(resp));
	}

	// 添加楼层
	public void saveFloor() {
		JSONObject jo = this.getJson();
		Resp resp = Duang.duang(IBedService.class).saveFloor(jo);
		renderJson(JsonKit.toJson(resp));
	}

	// 添加栋
	public void saveHouse() {
		JSONObject jo = this.getJson();
		Resp resp = Duang.duang(IBedService.class).saveHouse(jo,this.getUser());
		renderJson(JsonKit.toJson(resp));
	}
	
	//床位列表
	public void list() {
		JSONObject jo = this.getJson();
		Resp resp = Duang.duang(IBedService.class).getHallJson(jo,this.getUser());
		renderJson(JsonKit.toJson(resp));
	}
	
	
	/**
	 * 
	 * 床位比例概况
	 * @title 床位比例概况
	 * @param username|用户名|String|必填
	 * @respBody {"msg":"success","code":"10000","data":{"allSurplusBeds":114,"list":[{"houseName":"医养大楼","houseId":"6eef759d4c8198948203e382a903","totalBeds":114,"surplusBeds":114,"Beds":"医养大楼"},{"houseName":"老年公寓","houseId":"d2ccb5574fd180349cf9a42d3072","totalBeds":0,"surplusBeds":0,"Beds":"老年公寓"}],"allTotalBeds":114}}
	 */
	public void getData() {
		JSONObject jo = this.getJson();
		Resp resp = Duang.duang(IBedService.class).getData(jo, this.getUser());
		renderJson(JsonKit.toJson(resp));
	}
	
	
	/**
	 * 
	 * 概览楼栋的入住率
	 * @title 概览楼栋的入住率
	 * @param houseid|楼栋id|String|必填
	 * @respBody {"msg":"success","code":"10000","data":[{"name":"已用床位","value":4},{"name":"空床位","value":110}]}
	 */
	public void getDataUsagerate() {
		JSONObject jo = this.getJson();
		Resp resp = Duang.duang(IBedService.class).getDataUsagerate(jo);
		renderJson(JsonKit.toJson(resp));
	}
	
	/**
	 * 
	 * 概览统计床位类型图表
	 * @title 概览统计床位类型图表
	 * @respBody {"msg":"success","code":"10000","data":{"yAxis":[68,4,3,1,1,11],"xAxis":["1","2","3","4","5","6"]}}
	 * */
	public void getDataType() {
		JSONObject jo = this.getJson();
		Resp resp = Duang.duang(IBedService.class).getDataType(jo);
		renderJson(JsonKit.toJson(resp));
	}
	
	
	
	
	
	
	
	    
			
			
			

		
	

}
